<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div class='app-container'>
    <el-form ref="form" :model="quo" :rules="rules" label-width="100px" id="mvcfm">
      <div>
        <el-row>
          <el-col :span="24">
            {{quo.subject}}
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <hr>
            <span style='float:right;'>编号:{{quo.map['quo_client']}}/{{quo.map['quo_id']}}</span>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="报价公司" prop="">
              {{quo.dept_name}}
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="客户公司" prop="">
              {{quo.quo_client}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="联系人" prop="relation_person">
              {{quo.contact_name}}
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="联系人" prop="">
              {{quo.quo_contact}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="电话" prop="relation_cel">
              {{quo.relation_cel}}
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="电话" prop="">
              {{quo.quo_phone}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="电子邮箱" prop="relation_email">
              {{quo.relation_email}}
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="电子邮箱" prop="">
              {{quo.quo_email}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="传真" prop="">
              {{quo.pfax}}
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="传真" prop="">
              {{quo.quo_fax}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="QQ" prop="">
              {{quo.pqq}}
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="QQ" prop="">
              {{empty}}
            </el-form-item>
          </el-col>
        </el-row>
      </div>
      <el-table :data="pum">
        <el-table-column label="产品条形码" prop="product_barcode">
        </el-table-column>
        <el-table-column label="产品名称" prop="pronum_prodece">
        </el-table-column>
        <el-table-column label="产品型号" prop="product_model">
        </el-table-column>
        <el-table-column label="产品规格" prop="product_norm">
        </el-table-column>
        <el-table-column label="生产厂家" prop="">
        </el-table-column>
        <el-table-column label="补充" prop="product_simpledes">
        </el-table-column>
        <el-table-column label="简要描述" prop="product_des">
        </el-table-column>
        <el-table-column label="数量" prop="pronum_no">
        </el-table-column>
        <el-table-column label="单价" prop="pronum_price">
        </el-table-column>
        <el-table-column label="发货时间" prop="">
        </el-table-column>
        <el-table-column label="总价" prop="total_prices">
        </el-table-column>
      </el-table>
      <div>
        <el-row>
          <el-col :span="24">
            <el-form-item label="合计" prop="">
              {{s_num.total_prices}}
            </el-form-item>
          </el-col>
        </el-row>
      </div>
      <div class="form-unit">
        <span class="mvc-title-left"> 付款条件 </span>
      </div>
      <el-table :data="s_condition">
        <el-table-column label="备注" prop="condition_name">
        </el-table-column>
      </el-table>
      <div class="form-unit">
        <span class="mvc-title-left"> 报价说明 </span>
      </div>
      <el-table :data="s_explain">
        <el-table-column label="备注" prop="explain_name">
        </el-table-column>
      </el-table>
      <div>
        <input type="hidden" id="subject" name="subject" :value="quo.subject">
        <input type="hidden" id="发送邮件" name="replyMail" :value="quo.quo_email">
        <input type="hidden" id="contact_id" name="contact_id" :value="quo.quo_contact_idx">
        <input type="hidden" id="message" name="message" :value="quo.message">
      </div>
      <el-button @click="print();" type='primary' size="mini">打印</el-button>
      <el-button @click="printInfoSubmit('')" type='success' size="mini"><i class='fa fa-check'></i>邮件发送</el-button>
    </el-form>
  </div>
</template>
<script>
  import request from '@/utils/request'
  export default {
    name: 'PrintInfo',
    components: {},
    props: ['popparams'],
    data() {
      return {
        vueparams: this.getVUEParams(""),
        quo: {
          subject: null,
          quo_client: null,
          dept_name: null,
          quo_client: null,
          contact_name: null,
          quo_contact: null,
          relation_cel: null,
          quo_phone: null,
          relation_email: null,
          quo_email: null,
          pfax: null,
          quo_fax: null,
          pqq: null,
        },
        pum: [],
        s_num: {
          total_prices: null,
        },
        s_condition: [],
        s_explain: [],
        explain_id: {},
        loading: false,
        rules: {
          replyMail: [{
            required: true,
            message: "发送邮件不能为空",
            trigger: 'blur',
          }],
        }
      }
    },
    created() {
      this.getData();
    },
    updated() {},
    mounted() {},
    methods: {
      getData() {
        request({
          method: 'get',
          url: '/xcapi/VUEAction/crm/sale/OfferDetMes/printInfo?' + this.vueparams,
        }).then(data => {
          for (var k in data) {
            if (Array.isArray(data[k])) {
              this[k] = data[k];
            } else {
              $.extend(this[k], data[k]);
            }
          }
        })
      },
      printInfoSubmit(_params) {
        request({
          method: 'post',
          url: '/xcapi/VUEAction/crm/sale/OfferDetMes/printInfoSubmit?' + _params + this.vueparams,
          data: this.postData()
        }).then(data => {
          this.$router.replace("/redirect" + this.$route.fullPath);
          this.msgSuccess(data.msg);
        })
      },
    },
  }
</script>
